package base1;

import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;

import java.util.concurrent.TimeUnit;

/**
 * ClassName:BaseClass
 * Package:base1
 * Description:此处编写类描述内容
 * Date:2021/11/16 20:04
 * Author:zs
 */
public class BaseClass {
    static WebDriver driver;

    @BeforeAll
    static void init(){
        String browserName = System.getenv("browser");
        if("chrome".equals(browserName)){
            System.setProperty("webdriver.chrome.driver","D:/webDriver/bin/chromedriver.exe");
            driver=new ChromeDriver();
        }else if("firefox".equals(browserName)){
            //System.setProperty("webdriver.gecko.driver", "D:/webDriver/bin/geckodriver");
            System.setProperty("webdriver.firefox.bin","D:\\Program Files\\Mozilla Firefox\\firefox.exe");
            driver=new FirefoxDriver();
        }else if("ie".equals(browserName)){
            //System.setProperty("webdriver.ie.driver", "D:/webDriver/bin/IEDriverServer.exe");
            System.setProperty("webdriver.ie.bin", "C:/Program Files/internet explorer");
            driver=new InternetExplorerDriver();
        }

    //    System.out.println("driver:"+driver);
     //   driver.manage().timeouts().implicitlyWait(3, TimeUnit.SECONDS);
    }

    @AfterAll
    static void tearDown(){
        driver.quit();
    }
}
